{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Bayesian Statistics Made Simple\n",
    "===\n",
    "\n",
    "Code and exercises from my workshop on Bayesian statistics in Python.\n",
    "\n",
    "Copyright 2018 Allen Downey\n",
    "\n",
    "MIT License: https://opensource.org/licenses/MIT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# If we're running on Colab, install empiricaldist\n",
    "# https://pypi.org/project/empiricaldist/\n",
    "\n",
    "import sys\n",
    "IN_COLAB = 'google.colab' in sys.modules\n",
    "\n",
    "if IN_COLAB:\n",
    "    !pip install empiricaldist"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "import seaborn as sns\n",
    "sns.set_style('white')\n",
    "sns.set_context('talk')\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from empiricaldist import Pmf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### The Bayesian bandit problem\n",
    "\n",
    "Suppose you have several \"one-armed bandit\" slot machines, and reason to think that they have different probabilities of paying off.\n",
    "\n",
    "Each time you play a machine, you either win or lose, and you can use the outcome to update your belief about the probability of winning.\n",
    "\n",
    "Then, to decide which machine to play next, you can use the \"Bayesian bandit\" strategy, explained below.\n",
    "\n",
    "First, let's see how to do the update."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### The prior\n",
    "\n",
    "If we know nothing about the probability of wining, we can start with a uniform prior."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def decorate_bandit(title):\n",
    "    \"\"\"Labels the axes.\n",
    "    \n",
    "    title: string\n",
    "    \"\"\"\n",
    "    plt.xlabel('Probability of winning')\n",
    "    plt.ylabel('PMF')\n",
    "    plt.title(title)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbEAAAEtCAYAAACGdF6JAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3deZxdRZ338U9D2NMJi4gzjkAW55cZB0SID8JgJkhk1QghYXmJEUYUBCSCAioICM7EsDqIIiMjAQEJm+xLAhKCrBOcGR2BLwkQludRiGRrQQMk/fxRdeFwcrv7dqe7b07zfb9eeZ2+darOqXM7fX+3TtWpamlvb8fMzKyK1mp2BczMzHrKQczMzCrLQczMzCrLQczMzCrLQczMzCrLQczMzCprULMrYLamiIjpwOdLySuBV4EngB9JuqyB48wGtpa0dS9XsUvlc9euSVJLN4+zFrClpAVd5BsL3AscJml6+XX3at/peYZLeqbwuh24TNKhvXUOqyYHMbNVHQf8Mf/cAgwFDgGmR8R7JJ3bRfl/ATbqw/p1x8XA3d0pEBFDcpnbgdO7yP4E8DngwZ5UrsH6XAz8LbBrIflzwNN9dU6rDgcxs1XdWG6BRMR/AI8Dp0bEhZKWd1RY0qw+rl/DJD0EPNTNYpsCHyUFsa6O/xJwRQ+q1h17AAtK5+3rc1pFuE/MrAGS/gzcAgwBPtTk6phZ5paYWeNW5u0ggIhYAMwifRn8LOkW5EeAayn1iUXENsCZwFhgPeB/gO9JurGQZzbwF2Au8FXgNWA3Sb+tV5mIGAecAXwY+APwrTp5plPoE4uIFuDbub5bAUuBmcC3JL1Q6NMCOC0iTgOG5XpfCkwEzgG2AM4CZlO/D2xIRFwK7A+8CdwKnCjpD7keY+uVq9PHVpsXb6v8czH9HX1iEfEZ4CTS72A5MAc4RdJvCnnagW8CrwNHA38DPAWcIenaeu+zrdncEjNrQB7oMJb04fh4YdfBwHbAFOAnkhbWKftR4GFgR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w7SXMZHkMaofcc8E+SHsvHeonUynka+Dbpma2tSCMBfwR8KLe2GjpeD6/nSdLIzNGkYFEcfHErKci+CNzfwLEWATsBl+drOI80COME3jnSsTv1e4r0/qwk9RvW1Fplt69SaM11EOk93pv0iMHGOQ3q95dZL2tpb/eXBbN3i4hYjzSS82JJJzW7PlWWZxtZXh4FGxE7kEZWfiH3h1ofckvM7N3lINIs/9ObXI+BYALwakTsXEqvtcQe7ef6vCu5JWb2LhARXyMNptgLmCWpPJ2WdVNEbE56vvBV0qwvr5CmpjoMuFLS55pYvXcNt8TM3h3WJj1/9TCNDeiwLkhaSPpi8CBp0t8LgJ2BbwKHNq9m7y5uiZmZWWW5JWZmZpXlIGZmZpXlIGZmZpXlIGZmZpXlIGZmZpXlIGZmZpX1/wHgk73fEoeJgQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "bandit = Pmf.from_seq(range(101))\n",
    "bandit.plot()\n",
    "decorate_bandit('Prior distribution')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### The likelihood function\n",
    "\n",
    "The likelihood function that computes the probability of an outcome (W or L) for a hypothetical value of x, the probability of winning (from 0 to 1)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def likelihood_bandit(data, hypo):\n",
    "    \"\"\"Likelihood function for Bayesian bandit\n",
    "    \n",
    "    data: string, either 'W' or 'L'\n",
    "    hypo: probability of winning (0-100)\n",
    "    \n",
    "    returns: float probability\n",
    "    \"\"\"\n",
    "    x = hypo / 100\n",
    "    if data == 'W':\n",
    "        return x\n",
    "    else:\n",
    "        return 1-x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise 1:** Suppose you play a machine 10 times and win once.  What is the posterior distribution of $x$?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ8AAAEtCAYAAADX4G3qAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nOzdeXwU5f3A8c/mIOFIwn2DXPrFAznEW1Es1YoWUTzrUXv8WrWH1daj1qrVVot31WptbQUrVlEUr6qgglhFFBBQka8gIPcNIRy59/fHMxPWdZNskt2dTfJ9v155bTLzzMwzm935znPM84TC4TDGGGNMKmUEnQFjjDHNjwUfY4wxKWfBxxhjTMpZ8DHGGJNyFnyMMcaknAUfY4wxKWfBxxhjTMplBZ2B5kxEJgDfj1pcCewGPgceVtWJSTx+HpCrqpsTtL9bgJuBvqq6MhH7rO+xReRS4HFgpKrOrOO++qnq8jjShYGJqnpprL8TITovIjIT6KOqfRJ1jPoSkUOAO4ERwB5gGnBjbf/7dDqHpqwh34FUsOCTHq4Ctni/h4AC4CJggoh0VNV7En1AETkMeAm4EJiZoN0+DywDEhLMGmgWcDEuiMdNRB4FDgBGxpH8YuDLumct7rz8AHgYaBmx+E9A62QdM14iMhB4D8gE/gJsAy4HZovIMaq6Isj8GaCe34FUseCTHqZG3y2KyD+BxcBNIvKQqpYk+JiDgO6J3KGqLgIWJXKf9eWVFmotvcRwCrAyzmM8WY/918UJQG7UMacn+ZjxugvIA45X1fcAROQJYIm37uwA82Zo0HcgJazNJ02p6l7gZSAfODjg7BhTRURaACcD0/3AA+BV304AxopI24CyZxoJK/mkt0rvter/JCLH49o2jvIWfQjcoqqzItK0A+4DTgK6AGuAycAfVLU4on0EYIaIfOXXv4tIT+B24FTcne3nwN2qOili/xO84z+AqwYCuMBb9rU2HxHpANwGnAF0xJUqHgfuUtUKL80twPXePh7BVSv9SlX/G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AHuJV4bnswRl47VDPWKa9X+Z6lhXgU3p73xGSPFfXAYGzSxf26nX0q60YV8NeAXYQDgdiHrK34Rk+xHlTrEbuETM8Xu59uEO2NK3KO0mehJ3f2hm+4mi9I9JlQbwLrHuZpu7Z9Mvd4HrZjZC3CSHiSf2utT4FiEsOGJmLxA31HXAdiId81zOhLLx2qFeq9iV0oAn3P1RajsDnEuf9zYx1meEQu+smX0JTABvAFuBi+5ea8O+GvA5sIqo9+Du02Y2BmwGvnP3f9oYt1Lc/YaZXQYOmZkRa3w2Am+mLmVpQzEHKPIRPYu7XyAWFP5BPHkfAH4lFjXmVV7XiL3W3icUX78Br7v7eBrrTyKq+AU4SKy5eZFQlh0FVqbopqnx2vw9PxNKv7XETT4rCrhCOMffgdEmxroLvAycTL9hhBAHfMRs5Vwr9k0Q8zNN1MXq1KOgq/+6qHvZQczxJkJqviS1QXE9SMwxC2Zm5OSF6HbMbBGhDDzm7h932p5eJu3OcD+vqjSzNYRS751U7xPziCIfIXqDHcSu38c7bMf/ga3APTMbyrXXI58fKranL1HkI0QXY2YfEkX+t4Ab7p7fNki0iJktI9aH3SN2yZgituB5Gzjt7rs7aF7foMhHiO7mGWL9zPc0JzQQJbj7X4RDv0VsJvoFMAR8AuzpnGX9hSIfIYQQlaPIRwghROXI+QghhKgcOR8hhBCVI+cjhBCicuR8hBBCVI6cjxBCiMp5Ah9+yNcLRGknAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Solution\n",
    "\n",
    "for outcome in 'WLLLLLLLLL':\n",
    "    bandit.update(likelihood_bandit, outcome)\n",
    "    \n",
    "bandit.plot()\n",
    "decorate_bandit('Posterior distribution, 9 loss, one win')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Multiple bandits"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now suppose we have several bandits and we want to decide which one to play.\n",
    "\n",
    "For this example, we have 4 machines with these probabilities:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "actual_probs = [0.10, 0.20, 0.30, 0.40]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The function `play` simulates playing one machine once and returns `W` or `L`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from random import random\n",
    "from collections import Counter\n",
    "\n",
    "# count how many times we've played each machine\n",
    "counter = Counter()\n",
    "\n",
    "def flip(p):\n",
    "    \"\"\"Return True with probability p.\"\"\"\n",
    "    return random() < p\n",
    "\n",
    "def play(i):\n",
    "    \"\"\"Play machine i.\n",
    "    \n",
    "    returns: string 'W' or 'L'\n",
    "    \"\"\"\n",
    "    counter[i] += 1\n",
    "    p = actual_probs[i]\n",
    "    if flip(p):\n",
    "        return 'W'\n",
    "    else:\n",
    "        return 'L'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here's a test, playing machine 3 twenty times:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "L W L L L L L L W W W W L L L L W L L W "
     ]
    }
   ],
   "source": [
    "for i in range(20):\n",
    "    result = play(3)\n",
    "    print(result, end=' ')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now I'll make 4 `Pmf` objects to represent our beliefs about the 4 machines."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "prior = range(101)\n",
    "beliefs = [Pmf.from_seq(prior) for i in range(4)]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This function displays the four posterior distributions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "options = dict(xticklabels='invisible', yticklabels='invisible')\n",
    "\n",
    "def plot(beliefs, **options):\n",
    "    sns.set_context('paper')\n",
    "    for i, b in enumerate(beliefs):\n",
    "        plt.subplot(2, 2, i+1)\n",
    "        b.plot(label='Machine %s' % i)\n",
    "        plt.gca().set_yticklabels([])\n",
    "        plt.legend()\n",
    "        \n",
    "    plt.tight_layout()\n",
    "    sns.set_context('talk')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAakAAAEZCAYAAAAt5touAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAASm0lEQVR4nO3dXWxT9x3G8SexXd7jIQKMEJiYKv0LIhOTQIKKdigQuEFDZUBSCNyAVNa1RWMpopOAiK0SN5SVUdYqF6NFC2qRIiSQUMtLBoKuIt0oaAOdqBKBMFNUgkggKeC87CJOFJbEkBy//DDfz5V9bP7n7yM/POecHNtZHR0dAgDAoux0TwAAgP5QUgAAsygpAIBZlBQAwCxKCgBgFiUFADArGO9B5xzXpwNxeJ6X9STPI0tAfP1lKW5Jxf5h4mcDZADn3ICeT5aAvsXLEqf7AABmUVIAALMee7oPz4b29nZFIhFFo9F0T8WkUCikvLw8ZWezX4f4yFJ8A80SJQVJUiQSUU5OjnJyctI9FZOampoUiUSUn5+f7qnAOLIU30CzxG4hJEnRaJRQxZGTk8OeMZ4IWYpvoFmipAAAZlFSSJuqqipNnz5dzc3N3cvKysq0efPmJx5j6dKlvZZt3bp1UPO5d++e1q5dq1dffVV//etfBzUGkGrWciRJHR0devPNN1VbWzvoMbpQUkirCRMm6OzZs5Kk1tbWhLypt2/fPqh/V1lZqSVLlqiyslJnz57V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so6V+x259L+qk6t3XXtq9Lz7QyWte27bmN23s8noz3OllKPrKUegnJkp8jqa/VeV5RkgolnfMxFvr2W0lrY7dfVuc2nhe7/wtJ/0zDnDJdz/d11zb+t3NujnMuJOlnkrwkrpMsJQdZSr2EZMlPSX0maYZz7h+SWj3P+8rHWOjbB5KWOOf+Lmm0pL9IWuOcOyfptOd5/03n5DLUB+q9jf8oaYekryR95HnegwSvkywlH1lKvYRkiW9BBwCYxYd5AQBmUVIAALMoKQCAWZQUAMAsSgoAYBYlBQAwi5ICAJhFSQEAzPofivN8x3asNWMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot(beliefs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The following function updates our beliefs about one of the machines based on one outcome."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def update(beliefs, i, outcome):\n",
    "    \"\"\"Update beliefs about machine i, given outcome.\n",
    "    \n",
    "    beliefs: list of Pmf\n",
    "    i: index into beliefs\n",
    "    outcome: string 'W' or 'L'\n",
    "    \"\"\"\n",
    "    beliefs[i].update(likelihood_bandit, outcome)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise 2:** Write a nested loop that plays each machine 10 times; then plot the posterior distributions.  \n",
    "\n",
    "Hint: call `play` and then `update`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Solution\n",
    "\n",
    "for i in range(4):\n",
    "    for _ in range(10):\n",
    "        outcome = play(i)\n",
    "        update(beliefs, i, outcome)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAakAAAEZCAYAAAAt5tou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CzG8cSbfslsKTl68k0v8ZTW76fAuxWICZPd/513foaf2cwGMYZDAY9MBgwOvGckkvOIbnkeg7Jpe4UqfeBoQaDYTvQZDQad3TjWKJtLwNXGQyGb4Fw4B/AYoPBkAlsMhqNp5QMzkO9zI9f4z8ATwE7gNeMRmOjg88pueR8kkuu55BcklXQhRBCqJbczCuEEEK1pEgJIYRQLSlSQgghVEuKlBBCCNWSIiWEEEK1pEgJIYRQLSlSQgghVEuKlBBCCNX6f3Qq9jdZ2fIHAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Solution\n",
    "\n",
    "plot(beliefs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "After playing each machine 10 times, we can summarize `beliefs` by printing the posterior mean and credible interval:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "25.00001236675582 [ 8. 47.]\n",
      "16.68194469884906 [ 3. 36.]\n",
      "41.666666663460255 [20. 65.]\n",
      "16.68194469884906 [ 3. 36.]\n"
     ]
    }
   ],
   "source": [
    "for i, b in enumerate(beliefs):\n",
    "    print(b.mean(), b.credible_interval(0.9))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Bayesian Bandits\n",
    "\n",
    "To get more information, we could play each machine 100 times, but while we are gathering data, we are not making good use of it.  The kernel of the Bayesian Bandits algorithm is that it collects and uses data at the same time.  In other words, it balances exploration and exploitation.\n",
    "\n",
    "The following function chooses among the machines so that the probability of choosing each machine is proportional to its \"probability of superiority\".\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "def choose(beliefs):\n",
    "    \"\"\"Use the Bayesian bandit strategy to choose a machine.\n",
    "    \n",
    "    Draws a sample from each distributions.\n",
    "    \n",
    "    returns: index of the machine that yielded the highest value\n",
    "    \"\"\"\n",
    "    ps = [b.choice() for b in beliefs]\n",
    "    return np.argmax(ps)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This function chooses one value from the posterior distribution of each machine and then uses `argmax` to find the index of the machine that chose the highest value.\n",
    "\n",
    "Here's an example."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "choose(beliefs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise 3:** Putting it all together, fill in the following function to choose a machine, play once, and update `beliefs`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "def choose_play_update(beliefs, verbose=False):\n",
    "    \"\"\"Chose a machine, play it, and update beliefs.\n",
    "    \n",
    "    beliefs: list of Pmf objects\n",
    "    verbose: Boolean, whether to print results\n",
    "    \"\"\"\n",
    "    # choose a machine\n",
    "    machine = ____\n",
    "    \n",
    "    # play it\n",
    "    outcome = ____\n",
    "    \n",
    "    # update beliefs\n",
    "    update(____)\n",
    "    \n",
    "    if verbose:\n",
    "        print(i, outcome, beliefs[machine].mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Solution\n",
    "\n",
    "def choose_play_update(beliefs, verbose=False):\n",
    "    \"\"\"Chose a machine, play it, and update beliefs.\n",
    "    \n",
    "    beliefs: list of Pmf objects\n",
    "    verbose: Boolean, whether to print results\n",
    "    \"\"\"\n",
    "    # choose a machine\n",
    "    machine = choose(beliefs)\n",
    "    \n",
    "    # play it\n",
    "    outcome = play(machine)\n",
    "    \n",
    "    # update beliefs\n",
    "    update(beliefs, machine, outcome)\n",
    "    \n",
    "    if verbose:\n",
    "        print(i, outcome, beliefs[machine].mean())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here's an example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3 W 23.076939985507135\n"
     ]
    }
   ],
   "source": [
    "choose_play_update(beliefs, verbose=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Trying it out"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's start again with a fresh set of machines and an empty `Counter`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "beliefs = [Pmf.from_seq(prior) for i in range(4)]\n",
    "counter = Counter()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If we run the bandit algorithm 100 times, we can see how `beliefs` gets updated:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAakAAAEZCAYAAAAt5touAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3deXxU9b3/8deZJZN9sofsBAIHCEuQsIqCIGqV4lIEVNS2eFttrbbWWu29Wrr92tveavVaq5e2aq1Yl1IXLJVFQAGBsC/BCVs2spB9XyYz8/sjCQUMIcksZ5bP8/HwQTKZnPlkzCfvc77ne85XcTgcCCGEEN5Ip3UBQgghxKVISAkhhPBaElJCCCG8loSUEEIIryUhJYQQwmtJSAkhhPBahv6+qKqqzE8Xoh8Wi0UZyPOkl4To36V6qd+Q6vlG11cjhB9QVXVQz5deEqJv/fWSDPcJIYTwW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J/dzSS86EVCTQ1PNxC92HdMK1qoCfWSyWq3s+X4S85y5lsVg6LRbLR+c91Nfvta6n0c5/zJWkl9xPesnN3NVLzixg03TeC4QDDU5sS/TtELCv5+OPgBF0v9e9732hNmX5td739vz3+Pyli93xuy695H7SS57nkl5y5khqD93jigDzgN1ObEv07XvAip6Pr6b7PZ7b8/kcYK8GNfm783+ve9/jI6qqzlRV1QhMBPpfYte515Recg/pJc9zSS85E1JvATmqqn4GdFkslp1ObEv07ffAzaqqbgGigT8A96iquhv4xGKxnNGyOD/1e774Hv8c+BWwE3jJYrF0uPg1pZfcT3rJ81zSS3IXdCGEEF5LLuYVQgjhtSSkhBBCeC0JKSGEEF5LQkoIIYTXkpASQgjhtSSkhBBCeC0JKSGEEF5LQkoIIYTX+v9vxEvKrsRIZwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "num_plays = 100\n",
    "\n",
    "for i in range(num_plays):\n",
    "    choose_play_update(beliefs)\n",
    "    \n",
    "plot(beliefs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can summarize `beliefs` by printing the posterior mean and credible interval:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "12.067578772793167 [ 0. 34.]\n",
      "12.067578772793167 [ 0. 34.]\n",
      "35.29411764705883 [25. 47.]\n",
      "41.46341463414634 [29. 54.]\n"
     ]
    }
   ],
   "source": [
    "for i, b in enumerate(beliefs):\n",
    "    print(b.mean(), b.credible_interval(0.9))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The credible intervals usually contain the true values (10, 20, 30, and 40).\n",
    "\n",
    "The estimates are still rough, especially for the lower-probability machines.  But that's a feature, not a bug: the goal is to play the high-probability machines most often.  Making the estimates more precise is a means to that end, but not an end itself.\n",
    "\n",
    "Let's see how many times each machine got played.  If things go according to plan, the machines with higher probabilities should get played more often."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 6\n",
      "1 6\n",
      "2 49\n",
      "3 39\n"
     ]
    }
   ],
   "source": [
    "for machine, count in sorted(counter.items()):\n",
    "    print(machine, count)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "**Exercise 4:**  Go back and run this section again with a different value of `num_play` and see how it does."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
